<?php
class CategoryAction extends BaseAction{
	
	public function _initialize(){
		parent::_initialize();
		//echo 'hi';
		dump($_GET.ACTION_NAME);
	}
	
	public function _empty(){
		$channel_ids = array(
			'sanwen' => 1,
			'shige' => 2,
		);
		dump(ACTION_NAME);
		$this->category($channel_ids[ACTION_NAME],13);
	}
	
	public function category($channel_id,$type_id = 0){
		
		$listRows = 20;
		
		$cateDao = D('Archives');
		if($channel_id){
			$where['channel'] = $channel_id;
		}elseif($type_id){
			$where['typeid'] = $type_id;
		}else{
			$where['channel'] = $channel_id;
			$where['typeid'] = $type_id;
		}
		$count = $cateDao->where($where)->count();
		import('ORG.Util.Page');
		$p = new page($count,$listRows);
		$cateVo = $cateDao->where($where)->limit($p->firstRow.','.$p->listRows)->findall();
		//$cateVo = $cateDao->where($where)->limit(20)->findall();
		$page = $p->show();
		//dump($page);
		$this->assign('page',$page);
		$this->assign('cateVo',$cateVo);
		$this->display('category:category');
	}
}
?>